import java.util.Scanner;

public class ��־ͳ�� {
	
	static int n;
	static int d;
	static int k;
	static int t;
	static int id;
	static int N = 100010;
	static int[] a = new int[N];//��id
	static int[] b = new int[N];//���һ��ʱ��
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		n = s.nextInt();
		d = s.nextInt();//[t,t+d) k--->������
		k=s.nextInt();
		
		while(n-- >0) {
			t = s.nextInt();id = s.nextInt();
			if(a[id]==0) {
				b[id]=t;
				a[id]++;
			}
			else {
				if(0<=t && t<b[id]+d) a[id]++;
			}
		}
		
		
		for(int i=0;i<N;i++) 
			if(a[i]>=k) System.out.println(i);
	}
 
}
